***** Performance of all year 1 students, Table C4


clear
use "${data}cleaned_data.dta"
do "${blocks}construct_new_variables"

********************************************************************************
*
*                              Gender
*
********************************************************************************

*** All

reg ns_std_perc_y1 i.type i.Course i.ApplyCollege, vce(robust)
onesided 2.type
estadd local course_fe "\checkmark"
estadd local offer_college_fe ""
estadd local apply_college_fe "\checkmark"
eststo r1

*** MI subjects

reg ns_std_perc_y1 i.type i.Course_NatSci_split  i.ApplyCollege if EEM == 1, vce(robust)
onesided 2.type
estadd local course_fe "\checkmark"
estadd local offer_college_fe ""
estadd local apply_college_fe "\checkmark"
eststo r2

reg ns_std_perc_y1 i.type i.Course_NatSci_split i.ApplyCollege if EEM == 0, vce(robust)
onesided 2.type
estadd local course_fe "\checkmark"
estadd local offer_college_fe ""
estadd local apply_college_fe "\checkmark"
eststo r3

********************************************************************************
*
*                              School
*
********************************************************************************

gen type_state_school=1 if SchoolType=="Maintained" & DomicileCat=="Home" & WinterPool==0
replace type_state_school=2 if SchoolType=="Independent" & DomicileCat=="Home" & WinterPool==1

label define school 1 "Direct state-funded"  2 "Pooled privately-funded"
label values type_state_school school


reg std_perc_y1 ib1.type_state_school i.Course i.ApplyCollege, vce(robust)
onesided 2.type_state_school
estadd local course_fe "\checkmark"
estadd local apply_college_fe "\checkmark"
eststo r4


esttab r1 r2 r3 r4 using "${tables}first_year.tex", cells(b(pval(pval) fmt(2)) se(par fmt(2))) keep(2.type 2.type_state_school)  collabels(none) star(* 0.10 ** 0.05 *** 0.01) ///
scalars("course_fe Subject FE" ///
"apply_college_fe Application college FE") ///
eqlabels(none) label varwidth(25) nonumbers posthead("& Gender, all & Gender, MI &  Gender, non-MI  &  School \\" "& (1) & (2) & (3) & (4)  \\ \midrule") nonumbers mlabels(none) se(%9.2f) /// 
gaps booktabs nonotes replace
